<template>
  <div>
    <div>{{ uname }}</div>
    <div>
      <button @click="click">click me</button>
    </div>
    <div>
      <u-button type="primary" @click="jump">主要按钮</u-button>
    </div>
    <img :src="img" alt="" />
  </div>
</template>

<script lang="ts">
import Vue from "vue";
import { login } from "@/http/modules/login";
import { mapMutations } from 'vuex';
interface Obj{
  key:string,
  image:string
}
export default Vue.extend({
  data() {
    return {
      uname: "张三",
      img: "",
    };
  },
  created() {
    this.getImg();
  },
  methods: {
    ...mapMutations('user',['setToken']),
    jump(): void {
      uni.navigateTo({
        url: "/pages/home/home",
      });
    },
    click(): void {
      this.uname = "110";
    },
    getImg() {
      login().then((res:Obj) => {
        this.img = res.image;
      });
    },
  },
});
</script>

<style lang="scss" scoped>
.home {
  width: 750rpx;
  height: 300rpx;
  background: #f00;
}
</style>
